package com.zero.base;


import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.sql.Timestamp;
import java.util.UUID;

@Getter
@Setter
@MappedSuperclass
/*
 * 树形结构表数据基类
 */
public abstract class BaseTreeEntity extends BaseEntity {
    @Id
    @Column(name = "id", nullable = false)
    @ApiModelProperty("主键")
    private String id = UUID.randomUUID().toString();

    @Column(name = "create_time")
    @ApiModelProperty("创建时间")
    private Timestamp createTime;

    @Column(name = "update_time")
    @ApiModelProperty("修改时间")
    private Timestamp updateTime;

    @Column(name = "name")
    @ApiModelProperty("名称")
    private String name;

    @Column(name = "remarks")
    @ApiModelProperty("备注")
    private String remarks;

    @Column(name = "parent_id")
    @ApiModelProperty("父级id")
    private String parentId = "0";

    @Column(name = "parent_ids")
    @ApiModelProperty("所有父级id")
    private String parentIds = "0";

    @Override
    public String getKeyId() {
        return this.id;
    }
}
